﻿using Microsoft.SemanticKernel.ChatCompletion;
using OpenAI.Chat;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace semantic_kernel_api
{
    public class SendMessageDto
    {


        /// <summary>
        /// api地址
        /// </summary>
        public string endpoint { get; set; }

        /// <summary>
        /// api key
        /// </summary>
        public string apiKey { get; set; }


        /// <summary>
        /// 模型
        /// </summary>
        public string modelId { get; set; }

        /// <summary>
        /// 问题
        /// </summary>
        public string Query { get; set; }

        /// <summary>
        /// 最大记忆窗口
        /// </summary>
        public int? targetCount { get; set; } = 20;

        /// <summary>
        /// 系统提示词
        /// </summary>
        public string  prop { get; set; }


        /// <summary>
        /// 知识库id
        /// </summary>

        public string  dbid { get; set; }

        /// <summary>
        /// 历史记录
        /// </summary>
        public List<HistoryDto>   History { get; set; } = new List<HistoryDto>();



        /// <summary>
        /// 外部api列表
        /// </summary>
        public List<Openapijson> apilist { get; set; } = new List<Openapijson>();

        public Dictionary<string, McpConfig> mcpServers { get; set; }


    }


    /// <summary>
    /// mcp配置  
    /// </summary>
    public class McpConfig
    {

        /// <summary>
        /// sse地址
        /// </summary>
        public string url { get; set; }

        public string command { get; set; }


        public List<string> args { get; set; } = new List<string>();

        public Dictionary<string,string> env { get; set; }


        public string WorkingDirectory { get; set; }




    }

    public class ResponseMsg
    {

        /// <summary>
        /// 消息id
        /// </summary>
        public string messageid { get; set; }
        
        /// <summary>
        /// 问题
        /// </summary>
        public string Query { get; set; }

        /// <summary>
        /// 内容
        /// </summary>
        public string Content { get; set; }


        public List<toolsInfo> Tools { get; set; }

        /// <summary>
        /// token消耗信息
        /// </summary>
        public ChatTokenUsage Usage { get; set; }
    }


    public class toolsInfo { 
    
       public string Name { get; set; }

        public string Arguments { get; set; }

        public string Return { get; set; }

        public string  id { get; set; }

    }

    public class HistoryDto
    {
        /// <summary>
        /// 类型 Assistant：ai回复  User：用户消息
        /// </summary>
        public string Type = "";

        /// <summary>
        /// 内容
        /// </summary>
        public string content = "";
    
    }


    /// <summary>
    /// 外部api列表  Uri和Path  必填一个
    /// </summary>
    public class Openapijson
    {
        /// <summary>
        /// swagger.json地址  
        /// </summary>
        public string Uri { get; set; }

        /// <summary>
        /// swagger.json文件路径
        /// </summary>
        public string Path { get; set; }

        /// <summary>
        /// 接口名称
        /// </summary>
        public string Name { get; set; }
    }

}
